package com.xnyzc.lhy.mis.controller.cmsapi.invoice;

import com.xnyzc.lhy.common.entity.Rv;
import com.xnyzc.lhy.mis.entity.result.cms.invoice.OaSysInvoiceDidiApplyResults;
import com.xnyzc.lhy.mis.entity.result.cms.invoice.TcInvoiceInfoResults;
import com.xnyzc.lhy.mis.service.cms.invoice.MisOaSysInvoiceDidiApplyService;
import com.xnyzc.lhy.mis.service.cms.invoice.TcInvoiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 发票Controller
 * @author zhaolijie
 * @date
 */
@RestController
@RequestMapping(value = "/cms/invoice")
public class MisOaSysInvoiceDidiApplyController {

    @Autowired
    private MisOaSysInvoiceDidiApplyService misOaSysInvoiceDidiApplyService;
    @Autowired
    private TcInvoiceService tcInvoiceService;

    /**
     * 分页获取发票列表
     * @param oaSysInvoiceDidiApplyResults
     * @return
     */
    @PostMapping(value = "/getInvoiceList")
    public Rv getInvoiceList(@RequestBody OaSysInvoiceDidiApplyResults oaSysInvoiceDidiApplyResults) {
        return misOaSysInvoiceDidiApplyService.getInvoiceList(oaSysInvoiceDidiApplyResults);
    }

    /**
     *  获取同城发票列表
     * @return
     */
    @PostMapping(value = "/getTcInvoiceList")
    public Rv getTcInvoiceList(@RequestBody TcInvoiceInfoResults tcInvoiceInfoResults) {
        return tcInvoiceService.getInvoiceList(tcInvoiceInfoResults);
    }

    /**
     * 根据发票id更新发票状态和url（同城是手动的，不支持）
     */
    @GetMapping(value = "/updateTcInvoiceInfoById")
    public Rv updateTcInvoiceInfoById(Long id){
        return tcInvoiceService.getInvoiceInfoById(id);
    }
    /**
     *  根据条件获取同城发票列表
     * @return
     */
    @PostMapping(value = "/getTcInvoiceListByCondition")
    public Rv getTcInvoiceListByCondition(@RequestBody TcInvoiceInfoResults tcInvoiceInfoResults) {
        return tcInvoiceService.getInvoiceListByCondition(tcInvoiceInfoResults);
    }
    /**
     *  获取同城发票详情
     * @return
     */
    @PostMapping(value = "/getTcInvoiceInfo")
    public Rv getTcInvoiceInfo(@RequestBody Long id) {
        return tcInvoiceService.getInvoiceInfo(id);
    }

    /**
     * 获取发票状态字典信息
     * @return
     */
    @GetMapping(value = "/getInvoiceSysDict")
    public Rv getInvoiceSysDict() {
        return misOaSysInvoiceDidiApplyService.getInvoiceSysDict();
    }

    /**
     * 分页获取发票列表
     * @param oaSysInvoiceDidiApplyResults
     * @return
     */
    @PostMapping(value = "/exportGetInvoiceList")
    public Rv exportGetInvoiceList(@RequestBody OaSysInvoiceDidiApplyResults oaSysInvoiceDidiApplyResults) {
        return misOaSysInvoiceDidiApplyService.exportGetInvoiceList(oaSysInvoiceDidiApplyResults);
    }

    /**
     * 获取发票详情信息
     * @param recordId
     * @return
     */
    @GetMapping(value = "/getInvoiceItem")
    public Rv getInvoiceItem(Long recordId) {
        return misOaSysInvoiceDidiApplyService.getInvoiceItem(recordId);
    }

}
